home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6-1
/
Night Owl's Shareware - PDSI-006-1 - Night Owl Corp (1992).iso
/
033a
/
mfm_109b.arj
/
SORT.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1991-06-20
|
8KB
|
178 lines
{========================================================================}
Procedure SortList;
Var
TempSort : ListPtr;
SortNext, SortPrev, Exchange : Boolean;
Begin
If (BeginSort <> NIL) And (EndSort <> NIL) And (BeginSort <> EndSort) Then
Begin
SortNext := False; SortPrev := False; Altered := True;
AddToListOk;
New(TempSort);
NextPrintEntry := BeginSort;
While (NextPrintEntry <> EndSort) And (NextPrintEntry <> NIL) Do
Begin
NextPrintEntry := NextPrintEntry^.NextEntry;
If NextPrintEntry = EndSort Then SortNext := True;
End;
NextPrintEntry := BeginSort;
While (NextPrintEntry <> EndSort) And (NextPrintEntry <> NIL) Do
Begin
NextPrintEntry := NextPrintEntry^.PrevEntry;
If NextPrintEntry = EndSort Then SortPrev := True;
End;
If SortNext Then
Begin
Repeat
Exchange := False;
NextPrintEntry := BeginSort;
While NextPrintEntry <> EndSort Do
Begin
If NextPrintEntry^.FileName > NextPrintEntry^.NextEntry^.FileName Then
Begin
TempSort^.TypeOfRecord := NextPrintEntry^.TypeOfRecord;
TempSort^.FileName := NextPrintEntry^.FileName;
TempSort^.FileSize := NextPrintEntry^.FileSize;
TempSort^.FileDate := NextPrintEntry^.FileDate;
TempSort^.Description := NextPrintEntry^.Description;
NextPrintEntry^.TypeOfRecord := NextPrintEntry^.NextEntry^.TypeOfRecord;
NextPrintEntry^.FileName := NextPrintEntry^.NextEntry^.FileName;
NextPrintEntry^.FileSize := NextPrintEntry^.NextEntry^.FileSize;
NextPrintEntry^.FileDate := NextPrintEntry^.NextEntry^.FileDate;
NextPrintEntry^.Description := NextPrintEntry^.NextEntry^.Description;
NextPrintEntry^.NextEntry^.TypeOfRecord := TempSort^.TypeOfRecord;
NextPrintEntry^.NextEntry^.FileName := TempSort^.FileName;
NextPrintEntry^.NextEntry^.FileSize := TempSort^.FileSize;
NextPrintEntry^.NextEntry^.FileDate := TempSort^.FileDate;
NextPrintEntry^.NextEntry^.Description := TempSort^.Description;
Exchange := True;
End;
NextPrintEntry := NextPrintEntry^.NextEntry;
End;
Until (Not Exchange);
DisplayScreen;
End;
If SortPrev Then
Begin
Repeat
Exchange := False;
NextPrintEntry := BeginSort;
While NextPrintEntry <> EndSort Do
Begin
If NextPrintEntry^.FileName > NextPrintEntry^.PrevEntry^.FileName Then
Begin
TempSort^.TypeOfRecord := NextPrintEntry^.TypeOfRecord;
TempSort^.FileName := NextPrintEntry^.FileName;
TempSort^.FileSize := NextPrintEntry^.FileSize;
TempSort^.FileDate := NextPrintEntry^.FileDate;
TempSort^.Description := NextPrintEntry^.Description;
NextPrintEntry^.TypeOfRecord := NextPrintEntry^.PrevEntry^.TypeOfRecord;
NextPrintEntry^.FileName := NextPrintEntry^.PrevEntry^.FileName;
NextPrintEntry^.FileSize := NextPrintEntry^.PrevEntry^.FileSize;
NextPrintEntry^.FileDate := NextPrintEntry^.PrevEntry^.FileDate;
NextPrintEntry^.Description := NextPrintEntry^.PrevEntry^.Description;
NextPrintEntry^.PrevEntry^.TypeOfRecord := TempSort^.TypeOfRecord;
NextPrintEntry^.PrevEntry^.FileName := TempSort^.FileName;
NextPrintEntry^.PrevEntry^.FileSize := TempSort^.FileSize;
NextPrintEntry^.PrevEntry^.FileDate := TempSort^.FileDate;
NextPrintEntry^.PrevEntry^.Description := TempSort^.Description;
Exchange := True;
End;
NextPrintEntry := NextPrintEntry^.PrevEntry;
End;
Until (Not Exchange);
DisplayScreen;
End;
Dispose(TempSort);
End;
End;
{========================================================================}
Procedure SortListTime;
Var
TempSort : ListPtr;
SortNext, SortPrev, Exchange : Boolean;
Begin
If (BeginSort <> NIL) And (EndSort <> NIL) And (BeginSort <> EndSort) Then
Begin
SortNext := False; SortPrev := False; Altered := True;
AddToListOk;
New(TempSort);
NextPrintEntry := BeginSort;
While (NextPrintEntry <> EndSort) And (NextPrintEntry <> NIL) Do
Begin
NextPrintEntry := NextPrintEntry^.NextEntry;
If NextPrintEntry = EndSort Then SortNext := True;
End;
NextPrintEntry := BeginSort;
While (NextPrintEntry <> EndSort) And (NextPrintEntry <> NIL) Do
Begin
NextPrintEntry := NextPrintEntry^.PrevEntry;
If NextPrintEntry = EndSort Then SortPrev := True;
End;
If SortNext Then
Begin
Repeat
Exchange := False;
NextPrintEntry := BeginSort;
While NextPrintEntry <> EndSort Do
Begin
If NextPrintEntry^.FileDate > NextPrintEntry^.NextEntry^.FileDate Then
Begin
TempSort^.TypeOfRecord := NextPrintEntry^.TypeOfRecord;
TempSort^.FileName := NextPrintEntry^.FileName;
TempSort^.FileSize := NextPrintEntry^.FileSize;
TempSort^.FileDate := NextPrintEntry^.FileDate;
TempSort^.Description := NextPrintEntry^.Description;
NextPrintEntry^.TypeOfRecord := NextPrintEntry^.NextEntry^.TypeOfRecord;
NextPrintEntry^.FileName := NextPrintEntry^.NextEntry^.FileName;
NextPrintEntry^.FileSize := NextPrintEntry^.NextEntry^.FileSize;
NextPrintEntry^.FileDate := NextPrintEntry^.NextEntry^.FileDate;
NextPrintEntry^.Description := NextPrintEntry^.NextEntry^.Description;
NextPrintEntry^.NextEntry^.TypeOfRecord := TempSort^.TypeOfRecord;
NextPrintEntry^.NextEntry^.FileName := TempSort^.FileName;
NextPrintEntry^.NextEntry^.FileSize := TempSort^.FileSize;
NextPrintEntry^.NextEntry^.FileDate := TempSort^.FileDate;
NextPrintEntry^.NextEntry^.Description := TempSort^.Description;
Exchange := True;
End;
NextPrintEntry := NextPrintEntry^.NextEntry;
End;
Until (Not Exchange);
DisplayScreen;
End;
If SortPrev Then
Begin
Repeat
Exchange := False;
NextPrintEntry := BeginSort;
While NextPrintEntry <> EndSort Do
Begin
If NextPrintEntry^.FileDate > NextPrintEntry^.PrevEntry^.FileDate Then
Begin
TempSort^.TypeOfRecord := NextPrintEntry^.TypeOfRecord;
TempSort^.FileName := NextPrintEntry^.FileName;
TempSort^.FileSize := NextPrintEntry^.FileSize;
TempSort^.FileDate := NextPrintEntry^.FileDate;
TempSort^.Description := NextPrintEntry^.Description;
NextPrintEntry^.TypeOfRecord := NextPrintEntry^.PrevEntry^.TypeOfRecord;
NextPrintEntry^.FileName := NextPrintEntry^.PrevEntry^.FileName;
NextPrintEntry^.FileSize := NextPrintEntry^.PrevEntry^.FileSize;
NextPrintEntry^.FileDate := NextPrintEntry^.PrevEntry^.FileDate;
NextPrintEntry^.Description := NextPrintEntry^.PrevEntry^.Description;
NextPrintEntry^.PrevEntry^.TypeOfRecord := TempSort^.TypeOfRecord;
NextPrintEntry^.PrevEntry^.FileName := TempSort^.FileName;
NextPrintEntry^.PrevEntry^.FileSize := TempSort^.FileSize;
NextPrintEntry^.PrevEntry^.FileDate := TempSort^.FileDate;
NextPrintEntry^.PrevEntry^.Description := TempSort^.Description;
Exchange := True;
End;
NextPrintEntry := NextPrintEntry^.PrevEntry;
End;
Until (Not Exchange);
DisplayScreen;
End;
Dispose(TempSort);
End;
End;
{========================================================================}